
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class InsertTable {
	public static void main(String args[]) throws Exception {
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			Connection conn = DriverManager.getConnection
					("jdbc:oracle:thin:@127.0.0.1:1521:xe", "scott", "tiger");
			Statement stmt = conn.createStatement();
			stmt.executeUpdate("insert into product values ('00001', '00', '자바 프로그래밍', 50, 16500)");
			stmt.executeUpdate("insert into product values ('00002', '00', 'J2EE 구현 패턴', 40, 12000)");
			stmt.executeUpdate("insert into product values ('00002', '00', 'JSP 2.0', 60, 18000)");
			System.out.println("데이터들을 추가하였습니다.");
			stmt.close();
			conn.close();
		} catch (SQLException e) {
			// TODO: handle exception
			System.out.println("오류 발생 : " + e);
			System.out.println("오류 코드 : " + e.getErrorCode());
			System.out.println("오류 상태 : " + e.getSQLState());
		}
	}
}
